const timeRegExp = /\[(\d{2}):(\d{2})\.(\d{2,3})\]/

export default function parseLyric(lyricString){
  const lyricStrings = lyricString.split("\n");
  const lyricInfos = []
  for(const lineString of lyricStrings){
    const timeResult = timeRegExp.exec(lineString);

    // 1 获取时间
    if(!timeResult) continue;
    const minute = timeResult[1] * 60 * 1000;
    const second = timeResult[2] * 1000;
    const millsecond = timeResult[3] * 1;
    const time = minute + second + millsecond;

    // 2 获取歌词
    const text = lineString.replace(timeResult[0],"")

    lyricInfos.push({time,text})
  }
  return lyricInfos
}